package com.loop.collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c = new ArrayList<>();
        c.add(1);
        c.add(2);
        c.add(2);
        c.add(5);
        System.out.println(c);
        c.remove(2);

        System.out.println(c.contains(5));
        //c.clear();
        System.out.println(c.isEmpty());

        System.out.println(c.size());
        Object[] objects = c.toArray();
        for (int i = 0; i < objects.length; i++) {
            //String a = (String)objects[i];
            //System.out.println(a);
        }

        Collection c1 = new ArrayList<>();
        c1.add(4);
        c1.add(4);
        c1.add(7);
        c1.add(8);
        c1.add(9);
        c.addAll(c1);
        System.out.println(c);

        c.clear();
    }
}
